package com.indusfo.spc.mapper;

import com.indusfo.spc.pojo.Badreply;
import com.indusfo.spc.pojo.Badpheno;
import com.indusfo.spc.pojo.Badcause;
import org.apache.ibatis.annotations.Param;

import java.util.List;


/**
 * @ProjectName: IEIS2-COM
 * @Package: com.indusfo.spc.mapper
 * @ClassName: BadphenoMapper
 * @Author: 熊冰
 * @Description: 不良现象 数据层
 * @Date: 2019/8/20 15:24
 * @Version: 1.0
 */
public interface BadphenoMapper {
    //新增
    int insertSelective(Badpheno badpheno);

    //修改
    int updateByPrimaryKeySelective(Badpheno badpheno);

    //删除
    int deleteBadpheno(@Param("badphenoIds") Long[] ids, @Param("dataState") Integer dataState);

    //查询
    List<Badpheno> selectAllBadpheno(Badpheno badpheno);

    //总数
    int countBadpheno(Badpheno badpheno);

    //验证是否重复
    int countParamsNotRepeat(Badpheno badpheno);

    //添加不良原因
    int insertBadphenoBadcause(@Param("ids") Long[] ids, @Param("badphenoId") Integer badphenoId);

    //添加不良对策
    int insertBadphenoBadreply(@Param("ids") Long[] ids, @Param("badphenoId") Integer badphenoId);

    //删除不良原因
    int deleteBadphenoBadcause(@Param("ids") Long[] ids, @Param("badphenoId") Integer badphenoId);

    //删除不良对策
    int deleteBadphenoBadreply(@Param("ids") Long[] ids, @Param("badphenoId") Integer badphenoId);

    //查询不良原因
    List<Badcause> selectBadphenoBadcause(Badpheno badpheno);

    //查询不良对策
    List<Badreply> selectBadphenoBadreply(Badpheno badpheno);

    //总数查询不良原因
    int countBadphenoBadcause(Badpheno badpheno);

    //总数查询不良对策
    int countBadphenoBadreply(Badpheno badpheno);

    //查询不良原因  筛选
    List<Badcause> queryBadcause(Badpheno badpheno);

    //查询不良对策  筛选
    List<Badreply> queryBadreply(Badpheno badpheno);

    //总数查询不良原因  筛选
    int countBadcause(Badpheno badpheno);

    //总数查询不良对策  筛选
    int countBadreply(Badpheno badpheno);

    //查询子类全部
    List<Badpheno> queryListBadpheno(@Param("badpheno") Badpheno badpheno, @Param("childs") List<Integer> childs);

    //查询子类全部 总数
    Integer countListBadpheno(@Param("badpheno") Badpheno badpheno, @Param("childs") List<Integer> childs);

    /**
     * 去添加查询（产品，任务单，批次）
     */
    List<Badpheno> queryListBadphenoToInsert(Badpheno badpheno);

    /**
     * 总数
     */
    int countBadphenoToInsert(Badpheno badpheno);

    //查询子类全部
    List<Badpheno> queryListBadphenoToInserts(@Param("badpheno") Badpheno badpheno, @Param("childs") List<Integer> childs);

    //查询子类全部 总数
    Integer countListBadphenoToInserts(@Param("badpheno") Badpheno badpheno, @Param("childs") List<Integer> childs);
    
  //删除不良现象下全部不良原因
    int deleteAllBadphenoBadcauseByBadpheno(@Param("badphenoId") Integer badphenoId);

    //删除不良现象下全部不良对策
    int deleteAllBadphenoBadreplyByBadpheno(@Param("badphenoId") Integer badphenoId);

    // 判断采集项目是否使用不良现象
    int selectDete(@Param("badphenoIds")Long[] badphenoIds);
}
